<template>
  <div
    class="widgets"
    :style="{
      position:inpage?'relative':'absolute',
      left: val.rect.x + 'mm' ,
      top:  val.rect.y + 'mm',
      width: val.rect.width + 'mm',
      height: val.rect.height + 'mm',
      borderTop: borderTop,
      borderLeft: borderLeft,
      borderBottom: borderBottom,
      borderRight: borderRight,
    }"
  >
    <el-image :src="codeUrl" fit="fill" />
<!--    <div-->
<!--      class="text"-->
<!--      :style="{-->
<!--        display:val.style.ShowBarText ? '' : 'none',-->
<!--        fontSize: val.style.FontSize + 'pt',-->
<!--        fontWeight: val.style.Bold ? 'bold' : 'normal'-->
<!--      }"-->
<!--    >1234567890</div>-->
  </div>
</template>

<script>

import {getViewTypeByType, getTypeByViewType} from '../../utils/utils'
import viewMixins from "@/mixins/viewMixins";
const WIDGET_NAME = 'YL_TYPE_IMAGE'

export default {
  mixins: [viewMixins],
  name: WIDGET_NAME,
  setting: {
    viewType: WIDGET_NAME,
    type: getTypeByViewType(WIDGET_NAME),
    isEdit: true,
    dragable: true, // 是否可拖拽
    resizable: true, // 尺寸是否可变
    value: 'barcode123',
    rect: {
      x: 0,
      y: 0,
      width: 18,
      height: 18
    }
  },
  props: [
    'val', // 文本对象
    'inpage'
  ],
  methods: {
    updateText(e, uuid) {
      let text = e.target.innerHTML
      this.$vptd.commit('updateData', {
        uuid: uuid,
        key: 'value',
        value: text,
      })
    },
  },
  computed: {
    // 'QRCode', 'PDF417'
    codeUrl() {
      return require('./rgb.jpg')
    },
  },
}
</script>

